﻿#region Using Statemens
using System;
using System.Collections.Generic;
using GameBase.Screens;
using StarFox.ScreenComponents;
#endregion

namespace StarFox.Screens
{
    /// <summary>
    /// Options menu screen of the game.
    /// </summary>
    public class OptionsMenuScreen : StarFoxScreen
    {
        #region Initialization

        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        /// <param name="screenManager">The ScreenManager that this Screen is associated to.</param>
        public OptionsMenuScreen(ScreenManager screenManager)
            : base(screenManager)
        {
            Name = "OptionsMenuScreen";
        }

        /// <summary>
        /// Called when the Screen needs to be initialized.
        /// </summary>
        public override void Initialize()
        {
            Components3D.Add(new MenuBackground(this) { Duration = TimeSpan.FromSeconds(6) });

            ApplicationMenu menu = new ApplicationMenu(this);
            // menu title
            menu.MenuTitle = "TITLE_OPTIONS_MENU";
            // menu items
            List<ApplicationMenu.IMenuItem> auxMenuItems = new List<ApplicationMenu.IMenuItem>();
            auxMenuItems.Add(new ApplicationMenu.LinkItem("ITEM_CONTROLS", new ApplicationMenu.ButtonMessage[] { ApplicationMenu.ButtonMessage.SELECT, ApplicationMenu.ButtonMessage.BACK }));
            auxMenuItems.Add(new ApplicationMenu.LinkItem("ITEM_GRAPHICS", new ApplicationMenu.ButtonMessage[] { ApplicationMenu.ButtonMessage.SELECT, ApplicationMenu.ButtonMessage.BACK }));
            auxMenuItems.Add(new ApplicationMenu.LinkItem("ITEM_SOUNDS", new ApplicationMenu.ButtonMessage[] { ApplicationMenu.ButtonMessage.SELECT, ApplicationMenu.ButtonMessage.BACK }));
            menu.MenuItems = auxMenuItems;
            // menu actions
            menu.MenuAccept += (sender, args) =>
                {
                    #region Menu Actions

                    switch (args.Index)
                    {
                        case 0:
                            // controls
                            ScreenManager.AddScreen(new ControlOptionsScreen(ScreenManager));
                            break;
                        case 1:
                            // graphics
                            ScreenManager.AddScreen(new GraphicsOptionsScreen(ScreenManager));
                            break;
                        case 2:
                            // sounds
                            ScreenManager.AddScreen(new SoundOptionsScreen(ScreenManager));
                            break;
                        default:
                            break;
                    }

                    #endregion
                };

            Components2D.Add(menu);

            base.Initialize();
        }

        #endregion
    }
}